﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Employee.aspx.cs" Inherits="Admin_Employee" %>

<!DOCTYPE html>
<script runat="server">

</script>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>管理页面</title>
	<script src="../JavaScript/time.js">
	    
	</script>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 304px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td>
                    <asp:Label ID="lblSeach" runat="server" Text="搜索"></asp:Label>
                    <asp:TextBox ID="txtSeach" runat="server"></asp:TextBox>
                    <asp:Button ID="btnSeacrh" runat="server" OnClick="btnSeacrh_Click" Text="确定" />
                </td>
            </tr>
             <tr>
                <td>
                    <asp:Button ID="btnGWage" runat="server" Text="管理工资" OnClick="btnGWage_Click" />
                    <asp:Button ID="btnUser" runat="server" Text="管理用户" OnClick="btnUser_Click" />
                    <asp:Button ID="btnCalWage" runat="server" OnClick="btnCalWage_Click" Text="计算工资" />
                </td>
            </tr>
        </table>
        <table class="style1">
            <tr>
                <td class="style2">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        DataKeyNames="e_Id" DataSourceID="SqlDataSource1">
                        <Columns>
                            <asp:BoundField DataField="e_Id" HeaderText="员工Id" InsertVisible="False"
                                ReadOnly="True" SortExpression="e_Id" />
                            <asp:BoundField DataField="e_Name" HeaderText="员工名字" SortExpression="e_Name" />
                            <asp:CommandField HeaderText="详细资料" SelectText="详细资料" ShowSelectButton="True" />
                        </Columns>
                    </asp:GridView>
                </td>
                <td>
                    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
                        DataKeyNames="e_Id" DataSourceID="SqlDataSource2" Height="50px" OnItemDeleted="DetailsView1_ItemDeleted"
                        OnItemInserted="DetailsView1_ItemInserted" Width="125px">
                        <Fields>
                            <asp:BoundField DataField="e_Id" HeaderText="员工Id" InsertVisible="true"
                                ReadOnly="True" SortExpression="e_Id" />
                            <asp:BoundField DataField="e_Name" HeaderText="员工姓名" SortExpression="e_Name" />
                            <asp:BoundField DataField="e_Sex" HeaderText="性别" SortExpression="e_Sex" />
                            <asp:BoundField DataField="e_Place" HeaderText="地址" SortExpression="e_Place" />
                            <asp:BoundField DataField="e_Nation" HeaderText="民族" SortExpression="e_Nation" />
                            <asp:BoundField DataField="e_Phone" HeaderText="手机" SortExpression="e_Phone" />
                            <asp:BoundField DataField="u_Id" HeaderText="用户Id" SortExpression="u_Id" />
                            <asp:BoundField DataField="d_Id" HeaderText="职务Id" SortExpression="d_Id" />
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
                        </Fields>
                        <HeaderTemplate>
                            详细资料
                        </HeaderTemplate>
                    </asp:DetailsView>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:pmsConnectionString %>"
            SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:pmsConnectionString %>"
            DeleteCommand="DELETE FROM [Employee] WHERE [e_Id] = @e_Id" InsertCommand="INSERT INTO [Employee] ( [e_Id],[e_Name], [e_Sex], [e_Place], [e_Nation], [e_Phone], [u_Id], [d_Id]) VALUES (@e_Id, @e_Name, @e_Sex, @e_Place, @e_Nation, @e_Phone,@u_Id,@d_Id)"       
            SelectCommand="SELECT * FROM [Employee] WHERE ([e_Id] = @e_Id)" UpdateCommand="UPDATE [Employee] SET [e_Id] = @e_Id, [e_Name] = @e_Name, [e_Sex] = @e_Sex, [e_Place] = @e_Place, [e_Nation] = @e_Nation, [e_Phone] = @e_Phone, [u_Id] = @u_Id, [d_Id] = @d_Id WHERE [e_Id] = @e_Id">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="e_Id" PropertyName="SelectedValue"
                    Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="e_Id" Type="String" />
            </DeleteParameters>
            <UpdateParameters>        
                <asp:Parameter Name="e_Name" Type="String" />
                <asp:Parameter Name="e_Sex" Type="String" />
                <asp:Parameter Name="e_Place" Type="String" />
                <asp:Parameter Name="e_Nation" Type="String" />
                <asp:Parameter Name="e_Phone" Type="String" />
                <asp:Parameter Name="u_Id" Type="String" />
                <asp:Parameter Name="d_Id" Type="string" />
                <asp:Parameter Name="e_Id" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="e_Name" Type="String" />
                <asp:Parameter Name="e_Sex" Type="String" />
                <asp:Parameter Name="e_Place" Type="string" />
                <asp:Parameter Name="e_Nation" Type="String" />
                <asp:Parameter Name="e_Phone" Type="String" />
                <asp:Parameter Name="u_Id" Type="String" />
                <asp:Parameter Name="d_Id" Type="String" />
                <asp:Parameter Name="e_Id" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        
    </div>
    </form>
</body>
</html>
